package com.smasher.core.log;

import android.app.Application;
import android.content.Context;

import com.hjq.toast.ToastParams;
import com.hjq.toast.Toaster;
import com.hjq.toast.style.CustomToastStyle;
import com.smasher.core.R;

public class ToastUtil {

    public static void init(Application application) {
        // 初始化 Toast 框架
        Toaster.init(application);
    }


    public static void info(Context context, CharSequence message) {
        ToastParams params = new ToastParams();
        params.text = message;
        params.style = new CustomToastStyle(R.layout.toast_info);
        Toaster.show(params);
    }

    public static void info(Context context, int message) {
        ToastParams params = new ToastParams();
        params.text = context.getString(message);
        params.style = new CustomToastStyle(R.layout.toast_info);
        Toaster.show(params);
    }

    public static void warning(Context context, CharSequence message) {
        ToastParams params = new ToastParams();
        params.text = message;
        params.style = new CustomToastStyle(R.layout.toast_warn);
        Toaster.show(params);
    }

    public static void warning(Context context, int message) {
        ToastParams params = new ToastParams();
        params.text = context.getString(message);
        params.style = new CustomToastStyle(R.layout.toast_warn);
        Toaster.show(params);
    }

    public static void success(Context context, CharSequence message) {
        ToastParams params = new ToastParams();
        params.text = message;
        params.style = new CustomToastStyle(R.layout.toast_success);
        Toaster.show(params);
    }

    public static void success(Context context, int message) {
        ToastParams params = new ToastParams();
        params.text = context.getString(message);
        params.style = new CustomToastStyle(R.layout.toast_success);
        Toaster.show(params);
    }

    public static void error(Context context, CharSequence message) {
        ToastParams params = new ToastParams();
        params.text = message;
        params.style = new CustomToastStyle(R.layout.toast_error);
        Toaster.show(params);
    }

    public static void error(Context context, int message) {
        ToastParams params = new ToastParams();
        params.text = context.getString(message);
        params.style = new CustomToastStyle(R.layout.toast_error);
        Toaster.show(params);
    }
}
